<!--
 * @Author: zlc
 * @Date: 2022-03-29 19:04:14
 * @LastEditTime: 2022-08-01 10:14:28
 * @LastEditors: zlc
 * @Description: 富文本 :title="richTextData.title||'壹封家信'"
 * @FilePath: \teachernotice\packageA\pages\richTextWeb\richText.vue

  写：uni.setStorageSync('richTextData', { richTextData: value, richTextTypeName: 'content' })

  读：uni.getStorageSync('richTextData').richTextData
-->
<template>
  <view class="rich-text">
     <my-navbar :title="richTextData.title || theme.name" @handle="handleBack"></my-navbar>
    <view class="explain_content"><mp-html 
    @linktap="linktap" :content="richTextData[richTextTypeName]"
    :copy-link="false"
    ></mp-html></view>
  </view>
</template>
<script>
const app = getApp()
import { mapState } from 'vuex';
export default {
  name: 'richText',
  data() {
    return {
      richTextTypeName: '', //渲染标识
      richTextData: {},
    }
  },
  computed:{
    ...mapState({
			theme:state => state.Theme.theme,
		})
  },
  onLoad(options) {
    this.richTextData = uni.getStorageSync('richTextData').richTextData || '无数据'
    this.richTextTypeName = uni.getStorageSync('richTextData').richTextTypeName
  },
  methods: {
    // 返回上一页
    handleBack() {
      uni.removeStorageSync('richTextData')
      
    },
    linktap(value) {
       uni.navigateTo({
        url: `/pages/common/webView/index?url=${value.href}`,
      })
     
    },
  },
}
</script>
<style lang="scss" scoped>
.explain_content {
  padding: 0 20rpx;
}
.title {
  width: 350rpx !important;
  overflow: hidden;
  white-space: nowrap;
  margin: 0 auto;
  text-overflow: ellipsis;
  font-size: 32rpx;
  text-align: center;
}
</style>
